package com.pss.gateway.config;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.codec.Hex;
import org.springframework.security.crypto.keygen.BytesKeyGenerator;
import org.springframework.security.crypto.keygen.KeyGenerators;
import org.springframework.security.crypto.password.AbstractPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.util.EncodingUtils;

public class Test {
    private final BytesKeyGenerator saltGenerator = KeyGenerators.secureRandom();
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String pssc12q = encoder.encode("pss-cloud");
        System.out.println(pssc12q);
    }


//    public String encode(CharSequence rawPassword) {
//        byte[] salt = this.saltGenerator.generateKey();
//        byte[] encoded = this.encodeAndConcatenate(rawPassword, salt);
//        return String.valueOf(Hex.encode(encoded));
//    }
//
//    protected byte[] encodeAndConcatenate(CharSequence rawPassword, byte[] salt) {
//        return EncodingUtils.concatenate(new byte[][]{salt, this.encode(rawPassword, salt)});
//    }

}
